	<template>
		<!-- 付款流程表单 -->
		<view class="container">
			<u-form :model="form" ref="uForm" label-width="200">
			  <u-form-item label="任务名称"
			    ><u-input v-model="form.name" disabled
			  /></u-form-item>
			  <u-form-item label="所属流程"
			    ><u-input v-model="form.belong" disabled
			  /></u-form-item>
			  <u-form-item label="付款单位"
			    ><u-input v-model="formData.payCcName" disabled
			  /></u-form-item>
			  <u-form-item label="收款单位"
			    ><u-input v-model="formData.collectionCcName" disabled
			  /></u-form-item>
			  <u-form-item label="委托人"
			    ><u-input v-model="form.client" disabled
			  /></u-form-item>
			  <u-form-item label="流程发起人"
			    ><u-input v-model="form.initiator" disabled
			  /></u-form-item>
			  <u-form-item label="优先级"
			    ><u-input v-model="form.priority" disabled class="input-color"
			  /></u-form-item>
			  <u-form-item label="状态"
			    ><u-input v-model="form.status" disabled
			  /></u-form-item>
			  <u-form-item label="项目机会">
			    <u-input v-model="formData.paymentChanceName" disabled/>
			  </u-form-item>
			  <u-form-item label="所属合同">
			    <u-input v-model="formData.paymentContractName" disabled/>
			  </u-form-item>
			  <u-form-item label="付款金额">
			  	<u-input v-model="formData.paymentMoney" disabled
			  /></u-form-item>
			  <u-form-item label="付款原因">
				<u-input v-model="formData.paymentByReason" disabled
			  /></u-form-item>
			  <u-form-item label="创建时间">
			    <u-input v-model="form.time" disabled />
			  </u-form-item>
			</u-form>
		</view>
	</template>
	
	<script>
		import auditApi from "../../api/audit.js";
		import getNameApi from "../../api/getName.js";
		export default {
			name:"reimbursement",
			props:['form'],
			data() {
				return {
					formData:{
						paymentMoney:0,
						paymentByReason:'无',
						payCcName:'无',
						collectionCcName:'无',
						paymentContractName:'无',
						paymentChanceName:'无'
					}
				};
			},
			mounted() {
				setTimeout(()=>{
					this.getData()
				},0)
			},
			methods:{
				async getData(){
					const res1 = await auditApi.getAuditDetail(
						{"X-Access-Token": this.$store.state.token},
						this.form.table)
					let {
					  paymentMoney,
					  payCcId,//付款单位,
					  collectionCcId,//收款单位
					  paymentByReason,
					  paymentContractId,
					  paymentChanceId,
					} = res1.data.result;
					this.formData.paymentMoney = paymentMoney
					this.formData.paymentByReason = paymentByReason
					//通过id查询单位名称
					  if(payCcId){
						const res2 = await getNameApi.getCompanyName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{id:payCcId}
						  )
						  this.formData.payCcName = res2.data.result.name
					  }
					  if(collectionCcId){
						const res2 = await getNameApi.getCompanyName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{id:collectionCcId}
						  )
						  this.formData.collectionCcName = res2.data.result.name
					  }
					//通过id查询获取合同名称
					  if(paymentContractId){
						const res2 = await getNameApi.getContractName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{id:paymentContractId}
						  )
						  this.formData.paymentContractName = res2.data.result.contractName
					  }
					  //通过id查询获取项目机会名称
					  if(paymentChanceId){
						const res3 =  await getNameApi.getProjectName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{id:paymentChanceId}
						  )
							this.formData.paymentChanceName = res3.data.result.chanceName
					  }
				}
			}
		}
	</script>
	
	<style scoped lang="scss">
	.container {
	  width: 90%;
	  margin: 0 auto;
	}
	</style>